package main

import (
	"flag"
	"fmt"
	"guafo/internel/ioc"
	"net/http"

	"github.com/prometheus/client_golang/prometheus/promhttp"
)

var configFile = flag.String("config", "etc/dev.yaml", "配置文件路径")

func main() {
	engine := InitWebServer(*configFile)
	initPrometheus()
	ioc.SetUpOTEL(ioc.AppConfig)

	fmt.Println("草尼玛", ioc.AppConfig.OTELCfg.Url, ioc.AppConfig.ServiceName)

	engine.Run("0.0.0.0:8190")
}

func initPrometheus() {
	go func() {
		http.Handle("/metrics", promhttp.Handler())
		// 监听端口，可以做成可配置的
		http.ListenAndServe(":8191", nil)
	}()
}
